/**
 * 初始化病种指标配置表详情对话框
 */
var SdsQcentityIndexInfoDlg = {
    validateFields: {
    	parref: {
            validators: {
                notEmpty: {
                    message: '质控病种不能为空'
                }
            }
        },
    	idxType: {
            validators: {
                notEmpty: {
                    message: '指标分类不能为空'
                }
            }
        },
    	idxCode: {
            validators: {
                notEmpty: {
                    message: '指标代码不能为空'
                }
            }
        },
    	idxDesc: {
            validators: {
                notEmpty: {
                    message: '指标描述不能为空'
                }
            }
        },
    	indNo: {
            validators: {
                notEmpty: {
                    message: '顺序号不能为空'
                }
            }
        },
    	isActive: {
            validators: {
                notEmpty: {
                    message: '是否有效不能为空'
                }
            }
        },
    }
};


/**
 * 关闭此对话框
 */
SdsQcentityIndexInfoDlg.close = function() {
    parent.layer.close(parent.layer.getFrameIndex(window.name)); //先得到当前iframe层的索引,再执行关闭   
}

/**
 * 验证数据是否为空
 */
SdsQcentityIndexInfoDlg.validate = function () {
    $('#sdsQcentityIndexInfoForm').data("bootstrapValidator").resetForm();
    $('#sdsQcentityIndexInfoForm').bootstrapValidator('validate');
    return $("#sdsQcentityIndexInfoForm").data('bootstrapValidator').isValid();
}

/**
 * 提交新增
 */
SdsQcentityIndexInfoDlg.addSubmit = function() {

    if (!this.validate()) {
        return;
    }
    //提交信息
    Sys.ajaxForm('sdsQcentityIndexInfoForm',Sys.backendPath + "/sds/sdsqcentityindex/add",function(res) {
        Sys.success(res.message);
    	window.parent.SdsQcentityIndex.table.refresh();
        SdsQcentityIndexInfoDlg.close();
    });
}

/**
 * 提交修改
 */
SdsQcentityIndexInfoDlg.editSubmit = function() {

    if (!this.validate()) {
        return;
    }
    //提交信息
    Sys.ajaxForm('sdsQcentityIndexInfoForm',Sys.backendPath + "/sds/sdsqcentityindex/update",function(res) {
        Sys.success(res.message);
    	window.parent.SdsQcentityIndex.table.refresh();
        SdsQcentityIndexInfoDlg.close();
    });
}

$(function() {
	Sys.initValidator("sdsQcentityIndexInfoForm", SdsQcentityIndexInfoDlg.validateFields);
});
